round out tuple unpacking assignment, support underscores #22537
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #18710
Tuple unpacking assignment (
(a, b) = (1, 2)
) now checks the type of the RHS properly for whether it's a tuple and whether it has the correct number of variables as opposed to delegating it to thetuple
typeclass (#21767, supposedly this broke some macro code and a certain group blamed the separate VarTuple changes instead which if anything should make macros work better). The lowering code used to accomplish tuple unpacking assignment is now made into semantic code accordingly.Underscores are also now supported, meaning
(a, _) = (1, 2)
is now possible whena
is declared and_
isn't. This is a new feature so might have to be changelogged and documented, but it can be done later. The entire feature is 3 lines, 2 of which areelse:
andcontinue
. This fixes #18710.The temp that is generated by tuple unpacking assignment is also no longer named
_
for clarity.